package com.slashvision.im.contact

import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.ExperimentalComposeUiApi
import com.slashvision.im.ui.UScreen
import com.slashvision.im.ui.UText
import io.openim.android.sdk.models.ConversationInfo
import io.openim.android.sdk.models.UserInfo

@ExperimentalComposeUiApi
@Composable
fun PageAllContacts(vm: ContactViewModel, onItemClick: (UserInfo)->Unit) = UScreen() {
    Column {
        UText(text = "通讯录")
        vm.allFriends.observeAsState().value?.let {
            ContactList(contacts = it, onItemClick = onItemClick)
        }
    }
}


@ExperimentalComposeUiApi
@Composable
fun PageAllConv(vm: ContactViewModel, onItemClick: (ConversationInfo) -> Unit) = UScreen() {
    Column {
        UText(text = "通讯录")
        vm.allConv.observeAsState().value?.let {
            LastConvList(convs = it, onItemClick = onItemClick)
        }
    }
}


